import request from '@/utils/request'
import type { 
  ApiResponse, 
  Tag, 
  TagRequest, 
  PageResult,
  PageParams
} from '@/types'

// 标签相关API
export const tagApi = {
  // 获取标签列表
  getTagList: (params: PageParams): Promise<ApiResponse<PageResult<Tag>>> => {
    return request.get('/tags', { params })
  },

  // 创建标签
  createTag: (data: TagRequest): Promise<ApiResponse<Tag>> => {
    return request.post('/tags', data)
  },

  // 更新标签
  updateTag: (id: number, data: Partial<TagRequest>): Promise<ApiResponse<Tag>> => {
    return request.put(`/tags/${id}`, data)
  },

  // 删除标签
  deleteTag: (id: number): Promise<ApiResponse<string>> => {
    return request.delete(`/tags/${id}`)
  }
}